﻿using System;
using System.Configuration;
using System.IO;

namespace RemoteTestRunner.BusinessLogic
{
    public class RtrSettingsServer : IRtrSettings
    {
        #region IRtrSettings Members

        #region Properties

        public string DataPath
        {
            get { return ConfigurationManager.AppSettings["DataPath"]; }
            set { throw new NotImplementedException(); }
        }

        public string WorkingFolder
        {
            get
            {
                var path = ConfigurationManager.AppSettings["WorkingFolder"];

                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }

                return path;
            }
            set { throw new NotImplementedException(); }
        }

        public string MsTestPath
        {
            get { return ConfigurationManager.AppSettings["MSTestPath"]; }
            set { throw new NotImplementedException(); }
        }

        public int TestTimeoutSeconds
        {
            get { return int.Parse(ConfigurationManager.AppSettings["TestTimeoutSeconds"]); }
            set { throw new NotImplementedException(); }
        }

        public bool UseRunnerService
        {
            get { return bool.Parse(ConfigurationManager.AppSettings["UseRunnerService"]); }
            set { throw new NotImplementedException(); }
        }

        public bool FilterTests
        {
            get { return bool.Parse(ConfigurationManager.AppSettings["FilterTests"]); }
            set { throw new NotImplementedException(); }
        }

        public string RunnerServiceUrl
        {
            get { return ConfigurationManager.AppSettings["RunnerServiceUrl"]; }
            set { throw new NotImplementedException(); }
        }

        #endregion

        #endregion

        #region Event Handlers

        // public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        public event EventHandler SettingsSaved;

        #endregion

        #region Method

        public void Save()
        {
            throw new NotImplementedException();
        }

        public void Cancel()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
